<!DOCTYPE html>
<html class="iframe-h">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>后台登录</title>
    <link rel="stylesheet" type="text/css" href="__ROOT__/admin/layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="__ROOT__/admin/css/admin.css" />
    <link rel="stylesheet" href="__ROOT__/static/assets/css/page.css"/>
</head>

<body>
<div id="news">
    <div class="wrap-container clearfix">
        <div class="column-content-detail">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <div class="layui-inline tool-btn">
                        <a class="layui-btn layui-btn-small layui-btn-normal " href="service_add.html" ><i class="layui-icon">&#xe654;</i></a>
                    </div>
                </div>
            </form>
            <div class="layui-form" id="table-list">
                <table class="layui-table" lay-even lay-skin="nob">
                    <colgroup>
                        <col class="hidden-xs" >
                        <col class="hidden-xs" >
                        <col class="hidden-xs" >

                    </colgroup>
                    <thead>
                    <tr>
                        <th class="hidden-xs">ID</th>
                        <th class="hidden-xs">账号</th>
                        <th class="hidden-xs">姓名</th>
                        <th class="hidden-xs">手机号</th>
                        <th class="hidden-xs">备注</th>
                        <th class="hidden-xs">注册时间</th>
                        <th class="hidden-xs">状态</th>
                        <th >操作</th>

                    </tr>
                    </thead>
                    <tbody>
                    {empty name="name"}
                    <tr>
                        <td colspan="10" align="center"> 暂无数据... </td>
                    </tr>
                    {else /}
                    {volist name="list" id="vo" key="k"}
                    <tr>
                        <td class="hidden-xs">{$k}</td>
                        <td class="hidden-xs">{$vo.num}</td>
                        <td class="hidden-xs">{$vo.name}</td>
                        <td class="hidden-xs">{$vo.phone}</td>
                        <td class="hidden-xs">{$vo.beizhu}</td>
                        <td class="hidden-xs">{$vo.uptime}</td>
                        <td class="hidden-xs">
                            {switch vo.state}
                            {case 1}正常{/case}
                            {case 2}禁用{/case}
                            {default /}
                            {/switch}
                        </td>
                        <td>
                            <a class="layui-btn layui-btn-mini layui-btn-normal " href="{:url('service/service_edit')}?id={$vo.id}" data-status="1">修改</a>
                            <a href="#" id="del"  attr-id="{$vo.id}"class="layui-btn layui-btn-mini layui-btn-danger table-list-status" data-status="2">删除</a>
                            <a href="#" id="yes"  attr-id="{$vo.id}"class="layui-btn layui-btn-mini layui-btn-danger table-list-status" data-status="2">禁用</a>
                            <a href="#" id="no"   attr-id="{$vo.id}"class="layui-btn layui-btn-mini layui-btn-normal table-list-status" data-status="2">解禁</a>
                        </td>
                    </tr>
                    {/volist}
                    {/empty}

                    </tbody>
                </table>
                <div class="pages" style="float: left">{$page}</div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="__ROOT__/static/assets/js/jquery-2.1.4.min.js"></script>
<script src="__ROOT__/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="__ROOT__/admin/js/common.js" type="text/javascript" charset="utf-8"></script>
<script src="__ROOT__/static/assets/js/dialog/layer.js"></script>
<script src="__ROOT__/static/assets/js/dialog.js"></script>
<script>
    // 删除按钮
    $(" #del").click(function () {

        var id = $(this).attr('attr-id');
        var url ="{:url('service/service_del')}" ;
        data = {};
        data['id']=id;

        layer.open({
            type :0,
            title:'确认删除?',
            btn:['是','否'],
            icon:3,
            closeBtn:2,
            content:"是否确定删除",
            scrollbar:true,
            yes:function () {
                //执行跳转
                todelete(url,data);
            }
        });

    });

    function todelete(url,data) {
        $.post(
            url,
            data,
            function (s) {
                if(s.status ==1){
                    return dialog.success(s.message,'');
                }else{
                    return dialog.error(s.message);
                }
            }
            ,'JSON');

    }
</script>
<script>

    $(" #yes").click(function () {

        var id = $(this).attr('attr-id');
        data = {};
        data['id']=id;
        var url = "{:url('service/yes')}";


        layer.open({
            type :0,
            title:'确认禁用？',
            btn:['是','否'],
            icon:3,
            closeBtn:2,
            content:"是否确认禁用",
            scrollbar:true,
            yes:function () {
                //执行跳转
                todelete1(url,data);
            }
        });

    });
    $(" #no").click(function () {

        var id = $(this).attr('attr-id');
        data = {};
        data['id']=id;
        var url = "{:url('service/no')}";


        layer.open({
            type :0,
            title:'确认解禁？',
            btn:['是','否'],
            icon:3,
            closeBtn:2,
            content:"是否确认解禁",
            scrollbar:true,
            yes:function () {
                //执行跳转
                todelete1(url,data);
            }
        });

    });
    function todelete1(url,data) {
        var success = "{:url('service/index')}";
        $.post(
            url,
            data,
            function (s) {
                if(s.status ==1){
                    return dialog.success(s.message,success);
                }else{
                    return dialog.error(s.message);
                }
            }
            ,'JSON');

    }


</script>
</body>

</html>